package com.junsi.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.junsi.bean.TradeManages;
import com.junsi.mapper.TradeManageMapper;
import com.junsi.service.TradeManageService;

@Service
@Transactional(rollbackFor = Exception.class)
public class TradeManageServiceImpl implements TradeManageService{
	@Autowired
	private TradeManageMapper tradeManageMappers;

	@Override
	public boolean delete(Integer id) {

		int result = tradeManageMappers.delete(id);
		if (result == 1) {
			return true;
		} else {
			return false;
		}

	}

	@Override
	public List<TradeManages> listAll() {
		List<TradeManages> list = tradeManageMappers.listAll();
		return list;
	}

	@Override
	public boolean update(TradeManages o) throws Exception {

		int result = tradeManageMappers.update(o);
		if (result == 1) {
			return true;
		} else {
			return false;
		}
	}

	@Override
	public TradeManages findById(Integer id) {
		TradeManages tradeManages = tradeManageMappers.findById(id);
		  return tradeManages;
	}

	@Override
	public boolean insert(TradeManages o) throws Exception {

		int result = tradeManageMappers.insert(o);
		if (result == 1) {
			return true;
		} else {
			return false;
		}
	}

}
